<template>
  <div>
    <el-form :model="queryFormData" ref="projectForm" :inline="true" size="small">
      <el-form-item>
        <el-input v-model="queryFormData.proName" placeholder="请输入项目名称" suffix-icon="el-icon-search"
          @input="nameChangeHandler"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="queryFormData.proCode" placeholder="请输入项目编号" suffix-icon="el-icon-search"
          @input="codeChangeHandler"></el-input>
      </el-form-item>
    </el-form>
    <el-table :data="dataSource" stripe class="systemTable" @row-click="rowRadioClick">
      <el-table-column width="45">
        <template v-slot="scope">
          <el-radio v-model="radioSelect" :label="scope.row.id" @change.native="handleRadioRowChange(scope.row)">
            {{ '' }}
          </el-radio>
        </template>
      </el-table-column>
      <el-table-column prop="proName" label="项目名称">
      </el-table-column>
      <el-table-column prop="proCode" label="项目编号">
      </el-table-column>
      <el-table-column prop="creater" label="项目负责人">
      </el-table-column>
    </el-table>
    <!-- <el-pagination class="systemPagination" :current-page="pageParams.currentPage" :page-sizes="pageParams.pageSizes"
      :page-size="pageParams.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pageParams.total"
      @size-change="handleSizeChange" @current-change="handleCurrentChange">
    </el-pagination> -->
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel" size="small">取 消</el-button>
      <el-button type="primary" @click="onsubmit" size="small">确 定</el-button>
    </div>
  </div>
</template>

<script>
import singleTableMixin from '@/mixins/singleTableMixin'
import assetApi from '@/api/assetApi'
import { throttle } from '@/utils/public'
export default {
  name: 'selectProject',
  mixins: [singleTableMixin],
  data() {
    return {
      dataSource: [],
      apiUrl: {
        list: assetApi.assetManage.selectProject
      },
      isPage: false
    }
  },
  props: {
    show: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    show(newVal, oldVal) {
      this.showDialog = newVal
    }
  },
  methods: {
    onsubmit() {
      this.$emit('onsubmit', this.selectRow)
    },
    cancel() {
      this.$emit('cancel', false)
    },
    nameChangeHandler: throttle(function () {
      this.loadData()
    }, 500),
    codeChangeHandler: throttle(function () {
      this.loadData()
    }, 500)
  }
}
</script>

<style scoped>
.dialog-footer {
  margin-top: 15px;
  text-align: center;
}
</style>